/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package customTag;

import java.io.IOException;
 
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

/**
 *
 * @author Mr.Thanh
 */
public class box extends TagSupport {
    private String title;
  
    public box() {
        this.title="";
       
    }
    
    public box(String title, String content) {
        this.title = title;
        
    }
    
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    
    @Override
    public int doStartTag() throws JspException {
        JspWriter out = pageContext.getOut();
        try {
            out.println ("<div class='box'>");
            out.println ("<div class='box-head'>"+this.title+"</div>");
            out.println ("<div class='box-content'>");
            
        } catch (IOException ex) {
            Logger.getLogger(box.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return EVAL_BODY_INCLUDE;
    }
    
    @Override
    public int doEndTag() throws JspException {
        JspWriter out = pageContext.getOut();
        try {
            out.println ("</div>");
             out.println ("</div>");
        } catch (IOException ex) {
            Logger.getLogger(box.class.getName()).log(Level.SEVERE, null, ex);
        }
       
        return EVAL_PAGE;
    }

    
}
